package net;

import net.sf.json.JSONObject;

public class CommitJob {
	private String ftpAlgorithmUri;
	private String ftpParamsXmlUri;
	private JSONObject params;
	private String token;
	private String jhJobCommend;
	private String processTakId;
	private String algorithmHash;
	private String subUserName;
	private String osType;
	private String priority;
	private String useGpu;
	private String gpuType;
	private String resource;
	private String execNode;
	private String isMpi;
	private String nodeGroup;
	private String resourceOrder;
	private String jh_files;
	private String cpuNum;

	public CommitJob(String token, String jhJobCommend, String processTakId, String algorithmHash, String subUserName, String osType,
					 String priority, String gpuType, boolean useGpu, String resource, String execNode, boolean isMpi,
					 String nodeGroup, String resourceOrder,String jh_files,String cpuNum) {
		super();
		this.token = token;
		this.params = new JSONObject();
		this.jhJobCommend = jhJobCommend;
		this.processTakId = processTakId;
		this.algorithmHash = algorithmHash;
		this.subUserName = subUserName;
		this.osType = osType;
		this.priority = priority;
		this.gpuType = gpuType;
		this.useGpu = useGpu?"true":"false";
		this.resource = resource;
		this.execNode = execNode;
		this.isMpi = isMpi?"true":"false";
		this.nodeGroup = nodeGroup;
		this.resourceOrder = resourceOrder;
		this.jh_files = jh_files;
		this.cpuNum = cpuNum;
	}
	public String getRequestParam(){
		return "token="+this.token+"&params="+this.getParams().toString();
	}
	public JSONObject getParams(){
		this.params.put("JH_JOB_COMMAND", this.jhJobCommend);
		this.params.put("PROCESS_TASK_ID", this.processTakId);
		this.params.put("ALGORITHM_ID", this.algorithmHash);
		this.params.put("SUB_USER_NAME", this.subUserName);
		this.params.put("OS_TYPE", this.osType);
		this.params.put("PRIORITY", this.priority);
		this.params.put("USE_GPU", this.useGpu);
//		this.params.put("GPU_TYPE", this.gpuType);
//		this.params.put("RESOURCE", this.resource);
		this.params.put("EXEC_NODE", this.execNode);
		this.params.put("IS_MPI", this.isMpi);
		this.params.put("NODE_GROUP", this.nodeGroup);
		this.params.put("RESOURCE_ORDER", this.resourceOrder);
		this.params.put("JH_FILES", this.jh_files);
		this.params.put("CPU_NUM", this.cpuNum);
		return this.params;

	}

	public String getFtpAlgorithmUri() {
		return ftpAlgorithmUri;
	}
	public void setFtpAlgorithmUri(String ftpAlgorithmUri) {
		this.ftpAlgorithmUri = ftpAlgorithmUri;
	}
	public String getFtpParamsXmlUri() {
		return ftpParamsXmlUri;
	}
	public void setFtpParamsXmlUri(String ftpParamsXmlUri) {
		this.ftpParamsXmlUri = ftpParamsXmlUri;
	}
	public String getUseGpu() {
		return useGpu;
	}
	public void setUseGpu(boolean useGpu) {
		this.useGpu = useGpu?"true":"false";
	}
	public String getNodeGroup() {
		return nodeGroup;
	}
	public void setNodeGroup(String nodeGroup) {
		this.nodeGroup = nodeGroup;
	}
	public void setParams(JSONObject params) {
		this.params = params;
	}
	public String getToken() {
		return token;
	}
	public void setToken(String token) {
		this.token = token;
	}
	public String getJhJobCommend() {
		return jhJobCommend;
	}
	public void setJhJobCommend(String jhJobCommend) {
		this.jhJobCommend = jhJobCommend;
	}
	public String getProcessTakId() {
		return processTakId;
	}
	public void setProcessTakId(String processTakId) {
		this.processTakId = processTakId;
	}
	public String getAlgorithmHash() {
		return algorithmHash;
	}
	public void setAlgorithmHash(String algorithmHash) {
		this.algorithmHash = algorithmHash;
	}
	public String getSubUserName() {
		return subUserName;
	}
	public void setSubUserName(String subUserName) {
		this.subUserName = subUserName;
	}
	public String getOsType() {
		return osType;
	}
	public void setOsType(String osType) {
		this.osType = osType;
	}
	public String getPriority() {
		return priority;
	}
	public void setPriority(String priority) {
		this.priority = priority;
	}
	public String getGpuType() {
		return gpuType;
	}
	public void setGpuType(String gpuType) {
		this.gpuType = gpuType;
	}
	public String getResource() {
		return resource;
	}
	public void setResource(String resource) {
		this.resource = resource;
	}
	public String getExecNode() {
		return execNode;
	}
	public void setExecNode(String execNode) {
		this.execNode = execNode;
	}
	public String getMpi() {
		return isMpi;
	}
	public void setMpi(boolean isMpi) {
		this.isMpi = isMpi?"true":"false";
	}
	@Override
	public String toString() {
		return "CommitJob [params=" + params + ", token=" + token + ", jhJobCommend=" + jhJobCommend + ", processTakId="
				+ processTakId + ", algorithmHash=" + algorithmHash + ", subUserName=" + subUserName + ", osType="
				+ osType + ", priority=" + priority + ", useGpu=" + useGpu + ", gpuType=" + gpuType + ", resource="
				+ resource + ", execNode=" + execNode + ", isMpi=" + isMpi + ", nodeGroup=" + nodeGroup +", jh_file="
				+ jh_files + "， cpunum=" + cpuNum + "]";
	}


}